class LeverRenderer : public IBlockRenderer
{
public:
	ITexture *Texture;

	LeverRenderer(ITexture *texture) :
		Texture(texture)
	{
	}

	int GetTypeData(const int &data) { return data; }

	void Render(Schematic *schematic, RendererBase *renderer, const Block &block, const Point3i &position)
	{
		bool thrown = (block.Data & 0x08) != 0;
		byte placement = (byte)(block.Data & ~0x08);

		renderer->Translate(8, 8, 8);
		switch (placement)
		{
		case 1:
			renderer->Rotate(90, 0, 1, 0);
			break;
		case 2:
			renderer->Rotate(-90, 0, 1, 0);
			break;
		case 4:
			renderer->Rotate(180, 0, 1, 0);
			break;
		case 5:
			thrown = !thrown;
			renderer->Rotate(90, 1, 0, 0);
			break;
		case 6:
			thrown = !thrown;
			renderer->Rotate(90, 0, 1, 0);
			renderer->Rotate(90, 1, 0, 0);
			break;
		case 7:
			renderer->Rotate(-90, 1, 0, 0);
			break;
		case 0:
			renderer->Rotate(90, 0, 1, 0);
			renderer->Rotate(-90, 1, 0, 0);
			break;
		}
		renderer->Translate(-8, -8, -8);

		renderer->Draw(Box(Texture, Point3i(6, 8, 3), Point3i(5, 4, 0)).SetCoordsFromBounds(Point2i(0, 1 * 16)));

		renderer->Translate(8, 8, 8);
		renderer->Rotate(-90, 1, 0, 0);

		renderer->Translate(0, 6, 0);
		renderer->Rotate((thrown) ? -45 : 45, 1, 0, 0);
		renderer->Translate(-0, -6, -0);

		renderer->Translate(-8, -8, -8);

		renderer->Draw(Box(Texture, Point3i(2, 10, 2), Point3i(7, 4, 7)).SetSides(Point2i(0 + 7, 6 * 16 + 6)).SetTop(Point2i(0 + 7, 6 * 16 + 6)));
	}
};